#!/bin/bash
#这是备份目录，需要与config.php 一致
backupdir="/home/backup/"

if [ ! -d $backupdir ];then
    mkdir -p $backupdir
fi

# mkdir today backup

today=`date +%Y-%m-%d_%H_%M_%S`
fpath=$backupdir$today 
echo $fpath
if [ ! -d $fpath ];then
    mkdir $fpath
fi

# delete old file 

find $backupdir -type f -mtime +30 -print -exec /bin/rm -f {} \;

FL=`cat file.list`

for i in $FL ;do
	cp -Rp $i $fpath
done
cd $backupdir
#tar czf $today.tar.gz $today |split -b 100m
tar cjf - $today |split -b 90m - $today.tar.gz2.
#tar czf  $today.tar.gz  $today
rm -rf $today
cd -